<template>
  <div class="news">
    <div v-for="d in list" :key="d.ftid">
      <el-card>
        <template #header>
          <div class="card-header">
            <span>{{ d.intro }}</span>
          </div>
        </template>
        <div @click="showDetail(d.ftid)" class="Footerball-title">{{ d.tname }}</div>
        <template #footer>
          <div class="card-footer">
            {{ tools.formatDate(d.created) }}
          </div>
        </template>
      </el-card>
    </div>

    <!-- {{ list }} -->
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { api } from '../../js/ajax'
import { tools } from '../../js/tools'
import { ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router'

const router = useRouter()
const queryinfo = ref({ tname: '', orderBy: 1 })
const page = ref({
  pageNumber: 1,
  pageSize: 10,
})


const showDetail=ftid=>{
  router.push({
    path:'/crud/footerballdetail',
    query:{ftid:ftid},
  })
}


const list = ref([])
const query = () => {
  api.get('/crud/footballteam', tools.mergeJson(queryinfo.value, page.value), data => {
    if (data.success) {
      list.value = data.data.data
      page.value = data.data.pageBean
      return
    }
    ElMessageBox.alert(data.message, '足球俱乐部')
  })
}

query()
</script>

<style scoped>
.card-header,
.card-footer {
  color: red;
  font-size: 0.8em;
}

.card-footer {
  text-align: right;
}

.footerball {
  display: flex;
  flex-wrap: wrap;
}

.footerball > div {
  margin: 1rem;
  width: 30vw;
}

.Footerball-title {
  cursor: pointer;
  font-size: 1.2em;
  height: 3em;
}
</style>
